
from datetime import datetime
from django.db import models
from django.contrib.auth.models import AbstractUser


class MyUser(AbstractUser):
    SEX = (
        (0, '男'),
        (1, '女'),
    )
    LEVEL = (

        (0, '普通用户'),
        (1, '会员'),
        (2, '管理员'),
    )
    STATUS = (
        (0, '正常'),
        (1, '异常'),
    )

    name = models.CharField(verbose_name='昵称', blank=True, max_length=50,)
    mobile = models.CharField(verbose_name='手机号码', max_length=11, default="")
    sex = models.IntegerField(default=0, choices=SEX,verbose_name='性别')
    birthday = models.DateField(blank=True, null=True)
    user_img = models.ImageField(verbose_name="头像", upload_to="user_img", default="")
    level = models.IntegerField(default=0, choices=LEVEL,verbose_name='身份')
    status = models.IntegerField(default=0, choices=STATUS,verbose_name='状态')
    create_time = models.DateTimeField(default=datetime.now, verbose_name='创建时间')
    update_time = models.DateTimeField(default=datetime.now, verbose_name="更新时间")

    def __str__(self):
        return self.username
